<template>
  <ul>
    <li v-for="item in goodsList" :key="item.id" @click="jumpProducts(item.id)">
      <img :src="item.list_pic_url" style="display:block;" width="100%">
      <div class="van-ellipsis">{{item.name}}</div>
      <div class="price">{{ item.retail_price | RMBformat }}</div>
    </li>
   
  </ul>
</template>

<script>
export default {
  data() {
    return {
      imgSrc:require("@/assets/logo.png")
    };
  },
  methods:{
    jumpProducts(id){
      // 通过路由参数不同跳转，需要刷新
      this.$router.push("/productsDetail?id="+id)
      // 要加延时
      setTimeout(()=>{
        this.$router.go(0)
      })
      
    }
  },
  props:["goodsList"]
};
</script>
<style lang="less" scoped>
ul{
  padding: .1rem 2%;
  display:flex;
  justify-content:space-between;  //首位紧贴，中间留空
  flex-wrap:wrap; //自动换行
  li{
    width: 49%;
    margin-bottom: .1rem;
    background: #fff;
    text-align: center;
    line-height: .3rem;
    .price{
      color:darkred;
    }
  }
}
</style>